<template>
    <a-modal
        :title="title"
        :width="width"
        :visible="visible"
        switchFullscreen
        @cancel="handleCancel"
        class="printData"
    >
        <!--<div style="text-align: right;margin-bottom:10px;" >-->
        <!--<a-button type="primary" icon="printer" v-print="'#printTableList'">打印</a-button>-->
        <!--<a-button type="primary" icon="download" @click="openExcel" style="margin-left: 10px;">-->
        <!--导出Excel-->
        <!--</a-button>-->
        <!--</div>-->
        <template slot="footer">
            <a-button key="back" @click="handleCancel">
                关闭
            </a-button>
        </template>
        <div>
            <a-table
                ref="table"
                size="middle"
                bordered
                rowKey="id"
                :columns="columns"
                :dataSource="dataSource"
                :pagination="ipagination"
                :loading="loading"
                class="j-table-force-nowrap"
                @change="handleTableChange"
            >
                <template slot="htmlSlot" slot-scope="text">
                    <div v-html="text"></div>
                </template>
            </a-table>
        </div>

    </a-modal>
</template>

<script>
/**
 * create by Yang
 */
import '@/assets/less/TableExpand.less'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
    mixins: [JeecgListMixin],
    data() {
        return {
            title: '医疗机构名单详情',
            width: '80%',
            visible: false,
            // 表头
            columns: [],
            url: {
                list : null, // 小董接口
            },
        }
    },
    methods: {
        async show(info) {
            if (info && info.id) {
                this.url.list = '/hc/hcRecyclerCustomer/lineBindCustomer';
                this.visible = true;
                this.queryParam.lineId = info.id;
                // 把医院名字添加到标题
                if (info.lineName) {
                    this.title = `【${info.lineName}】医疗机构名单详情`
                } else {
                    this.title = '医疗机构名单详情'
                }
                this.setColumns();
                this.loadData(1)
            }
        },
        // 设置表格头部信息
        setColumns() {
            this.columns = [
                {
                    title: '序号',
                    dataIndex: 'id',
                    key: 'rowIndex',
                    width: 60,
                    align: 'center',
                    customRender: (text, row, index) => {
                        return parseInt(index) + 1
                    }
                },
                {
                    title: '机构名称',
                    align: 'center',
                    dataIndex: 'customerName',
                    key: 'customerName',
                },
                {
                    title: '收运人',
                    align: 'center',
                    dataIndex: 'recyclePersonName',
                    key: 'recyclePersonName',
                },
            ]
        },
        close() {
            this.$emit('close')
            this.visible = false
            this.dataSource = []
        },
        handleOk() {
            this.close()
        },
        handleCancel() {
            this.close()
        },
        handleEdit() {

        }
    }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
